package chat

import (
	"bufio"
	"fmt"
)

func readData(ids string, rw *bufio.ReadWriter) {
	for {
		str, _ := rw.ReadString('\n')

		if str == "" {
			return
		}
		if str != "\n" {
			// Green console colour: 	\x1b[32m
			// Reset console colour: 	\x1b[0m
			fmt.Printf("\x1b[32m%s\x1b[0m> ", str)
			// 回写到其他客户端
			for i, v := range cache_maps {
				if i == ids {
					continue
				}
				v.Write([]byte(ids + ": " + str))
			}
		}

	}
}
